<?php
/** application/libraries/MY_Form_validation **/ 
class MY_Form_validation extends CI_Form_validation 
{
    public $CI;
	
	public function __construct($rules = array())
	{
		parent::__construct($rules);
		$this->set_error_delimiters('','<br />');
	}
	public function exists($str, $field)
	{
		list($table, $field)=explode('.', $field);
		$query = $this->CI->db->limit(1)->get_where($table, array($field => $str));
		
		return $query->num_rows() !== 0;
    }
	
	public function add_error($field, $message)
	{
		$this->_error_array[$field] = $message;		
	}
}